//
//  AirPlaceInfo.m
//  EasyToo
//
//  Created by 郑 哲 on 9/6/13.
//
//

#import "AirPlaceInfo.h"

@implementation AirPlaceInfo

- (id)initWithDictionary:(NSDictionary *)jsonDictionary
{
    self = [self init];
    if (self) {
        NSArray *dictJsonArray = GetDictionaryArrayDefaultNil(jsonDictionary, @"date");
        if (dictJsonArray) {
            self.airList = [[NSMutableArray alloc]init];
            
            for (int i = 0; i < [dictJsonArray count]; i++) {
                NSDictionary *itemDict = [dictJsonArray objectAtIndex:i];
                
                AirInfo *airInfo = [[AirInfo alloc] initWithDictionary:itemDict];
                [self.airList addObject:airInfo];
                
            }
        }
    }
    return self;
}
@end



@implementation AirInfo

- (id)initWithDictionary:(NSDictionary *)jsonDictionary
{
    self = [self init];
    if (self) {
        //解析每一项
        self.fltno = GetDictionaryStringDefaultNil(jsonDictionary, @"fltno");
        self.sc = GetDictionaryStringDefaultNil(jsonDictionary, @"sc");
        self.scAirdrome = GetDictionaryStringDefaultNil(jsonDictionary, @"scAirdrome");
        self.ec = GetDictionaryStringDefaultNil(jsonDictionary, @"ec");
        self.ecAirdrome = GetDictionaryStringDefaultNil(jsonDictionary, @"ecAirdrome");
        self.deptime = GetDictionaryStringDefaultNil(jsonDictionary, @"deptime");
        self.arrtime = GetDictionaryStringDefaultNil(jsonDictionary, @"arrtime");
        self.planesty = GetDictionaryStringDefaultNil(jsonDictionary, @"planesty");
        self.stopnum = GetDictionaryStringDefaultNil(jsonDictionary, @"stopnum");
        self.etkt = GetDictionaryStringDefaultNil(jsonDictionary, @"etkt");
        self.meal = GetDictionaryStringDefaultNil(jsonDictionary, @"meal");
        
        //班次
        NSArray *classJsonArray = GetDictionaryArrayDefaultNil(jsonDictionary, @"classs");
        if (classJsonArray)
        {
            self.classArray = [[NSMutableArray alloc] init];
            for (int i = 0; i < [classJsonArray count]; i++)
            {
                NSDictionary *classDict = [classJsonArray objectAtIndex:i];
                
                ClassInfo *classInfo = [[ClassInfo alloc] initWithDictionary:classDict];
                
                [self.classArray addObject:classInfo];
            }
        }
        
    }
    return self;
}

@end


@implementation ClassInfo

- (id)initWithDictionary:(NSDictionary *)jsonDictionary
{
    self = [self init];
    if (self) {
        self.classname = GetDictionaryStringDefaultNil(jsonDictionary, @"classname");
        self.num = GetDictionaryStringDefaultNil(jsonDictionary, @"num");
        self.saleprice = GetDictionaryStringDefaultNil(jsonDictionary, @"saleprice");
        self.classcode = GetDictionaryStringDefaultNil(jsonDictionary, @"classcode");
        self.buildfee = GetDictionaryStringDefaultNil(jsonDictionary, @"buildfee");
        self.fuelfee = GetDictionaryStringDefaultNil(jsonDictionary, @"fuelfee");
        self.isApply = GetDictionaryStringDefaultNil(jsonDictionary, @"isApply");
        self.tgqInfo = GetDictionaryStringDefaultNil(jsonDictionary, @"tgqInfo");
        self.aheadDays = GetDictionaryStringDefaultNil(jsonDictionary, @"aheadDays");
        
    }
    return self;
}

@end


@implementation OrderAirInfo

@end

